Programming in C

Enter The Jungle

Page yet to be writen will be writen after my board
examinations. Now that I have got my admit card.
wish me best of luck

Topics in this page

 
 

Why do I need to do programming?

Well most people believe that they don't need to know computer programming to do computers. They are right too. Well there are all kinds of software in the market. So why do I need to do programming. To tell you frankly we don't need to do it. But if you are a person like me who wonders how do programs work then you have to know programming. After the initial curve of learning most people like me find writing a program is a mixture of painting, and LEGO. Believe me once you know how to go about basic stuff you will be able to write programs which will keep you busy throughout. I first big project that is a text editor was a real challenge and I finished it a few weeks back. Now I am working on my next project that is an interpreter programing language, come to think of it the second one though sounds incredible, I am doing it with much more ease than the text editor. The first project is always difficult just as the first program you write yourself. After that it's gets easier and easier. All programming requires is a dedicated heart and that's it.
Back to 'Topics in this page'

Introduction to C programming :

Programming is a very simple affair if you get a hang of it.
 
 
 

Subtropics

 
 
 

Our first programs
 
 
 
//this is our first C program 

#include<stdio.h> 

main(int) 

 printf("Hello World"); 
}
 
 

When you run this the program will have a output like this:
 
c:\work\>rhide 
Hello World 
 
 
 
 

The printf statement is used to print data on the screen. Don't bother about the other lines now we will come to it later.

Now see the output carefully you will notice the 'c:\work\>rhide' above the line 'Hello World', this line is there because we did not clear the screen the next example we will over come this.
 
 
 
 
//this is our second  C program 

#include<stdio.h> 
#include<conio.h> 

main(int) 

 clrscr(); //this function clears the  screen 
 printf("Hello World"); 
}
 
 

When you run this the program will have a output like this:
 
Hello World 
 
 
 

 

See the difference in the output. In the code '#include<conio.h>',  in C programming language there are very few internal commands (unlike in basic where all the commands are internal). Here we have a rich collection of standard header files which we write at the top of the program (in this format #include<headerfile.h>), These files or header files contain lot's of functions (commands) for example printf , clrscr,..... there are many of these which we will learn in the coming topics.
 

 Back to 'Topics in this page'

 
 
 

Writing basic output programs

Now we will write programs which will do basic output programs. In this sub topic we will learn more basic output programs. writing a single line on the screen will not get our work done. For example if we want to write a program which would display a menu on the screen.

For that we will learn the use of  \n \t in printf function. \n stands for new line, \t for tab.

See the use of \n in the program
 
 
#include<stdio.h> 
#include<conio.h> 

main(int) 

 clrscr(); //this function clears the  screen 
 printf("Hello World\nBye world"); 
}
 
 

Output:
Hello World
Bye world
 
 
 
 
 
 
Here is the use of a \t in printf function
#include<stdio.h> 
#include<conio.h> 

main(int) 

 clrscr(); //this function clears the  screen 
 printf("Hello World\tBye world"); 
}
 
 

Output:
Hello World        Bye world
 
 
 
 
 
 
I hope you know how to write basic a few display programs yourself. (Try Practice Program)

Back to 'Topics in this page'
Variables and data types The first question that comes to mind is "what the hell are variables and data types?". Variables are the feature by which we store data in the memory or RAM. You must have worked with a calculator. When you punch in the numbers where do you think it goes. The answer is when you punch those numbers in it goes to the memory where it is stored. In this section we will learn how to use variables and data types, which will enable you to write few useful programs.

In C there are the following data types:
 
 

The above data types are also called primitive data types (don't ask me why ?).
 
 
 
 
 

Back to Main Page